<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTagsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tags', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name', 10)->default('')->comment('标签');
            $table->integer('user_id')->default(0)->comment('添加者uid');
            $table->unsignedTinyInteger('type')->default(0)->comment('提供给系统分类');
            $table->tinyInteger('sort')->default(0)->comment('给系统指定标签排序');
            $table->timestamps();

            $table->unique('name');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('tags');
    }
}
